package com.ruoyi.media.forestApi;

import com.dtflys.forest.annotation.*;
import com.dtflys.forest.http.ForestResponse;

@BaseRequest(
        baseURL = "https://api.weixin.qq.com/"
)
public interface WechatMpUtilApi {


    /**
     * 获取公众号accessToken
     * @param appId
     * @param secret
     * @return
     */
    @Get(url = "cgi-bin/token?grant_type=client_credential&appid=${appId}&secret=${secret}")
    String getAccessToken(@Var("appId")String appId,@Var("secret")String secret);


    /**
     * 获取公众号登录授权二维码ticket
     * @return
     */
    @Post(url = "cgi-bin/qrcode/create?access_token=${accessToken}",
    headers = {
            "Accept:application/json",
            "Content-Type:application/json"
    })
    String getScanTicket(@Var("accessToken") String accessToken, @JSONBody String params);


    /**
     * 获取公众号登录二维码
     * @param ticket
     * @return
     */
    @Get(url = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=${ticket}")
    ForestResponse getScanQR(@Var("ticket")String ticket);

}
